Những câu hỏi liên quan
Ánh sao
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 4 2021 lúc 7:39

Uses crt;

Var a:array[1..6] of integer;

I,t:integer,

Begin

Clrscr;

For i:=1 to 6 do

Begin

Write('a[',i,']='); readln(a[i]);

End,

T:=0;

For i:=1 to 6 do

If (a[i] mod 3=0) and (a[i] mod 5=0) then t:=t+a[i];

Writeln(t);

Readln;

End.

Bình luận (0)
Thảo Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
24 tháng 12 2021 lúc 10:41

#include <bits/stdc++.h>

using namespace std;

long long a[10000],n,i,t;

int main()

{

cin>>n;

t=0;

for (i=1; i<=n; i++)

{

cin>>a[i];

t=t+a[i];

}

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

dem=0;

for (i=1; i<=n; i++) 

if (a[i] %2==0) dem++;

cout<<dem<<endl;

cout<<t;

return 0;

}

Bình luận (0)
Benny
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 3 2023 lúc 14:55

6:

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,A[100],i,dem=0;

cin>>n;

for (int i=1; i<=n; i++) cin>>A[i];

for (int i=1;i<=n; i++)

if (A[i]%2!=0) dem++;

cout<<dem;

return 0;

}

5:

#include <bits/stdc++.h>

using namespace std;

int main()

{

long long n,nn=1e6,A[1000];

cin>>n;

for (int i=1; i<=n; i++) cin>>A[i];

for (int i=1; i<=n; i++)

nn=min(nn,A[i]);

for (int i=1; i<=n; i++)

if (nn==A[i]) cout<<i<<" ";

return 0;

}

Bình luận (0)
Kien
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 10 2021 lúc 0:04

uses crt;

var a:array[1..100]of integer;

i,n:integer;

begin

clrscr;

readln(n);

for i:=1 to n do 

  readln(a[i]);

for i:=1 to n do 

  write(a[i]:4);

writeln;

for i:=1 to n do 

  if (a[i]+a[i+1] mod 10=0) then 

begin

writeln(a[i],' ',a[i+1]);

writeln(i,' ',i+1);

end;

readln;

end.

Bình luận (2)
Danh Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 7:23

Bài 1:

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t;

int main()

{

cin>>n;

t=0;

for (i=1; i<=n; i++)

{

cin>>x;

if ((x<0) and (x%2!=0)) t=t+x;

}

cout<<t;

return 0;

}

Bình luận (0)
Kien
Xem chi tiết
bùi thị kim liên
Xem chi tiết
Lê Thị Thu Huyền
24 tháng 11 2021 lúc 10:01

bprogram min 

uses crt 

var A: array [1...250] of integer

tong :integer;

begin 

tong:=0

writeln(‘nhap n:’); readln (n) 

forr i:=1 to n do 

begin 

writeln (‘nhap phan tu thu ‘,i);

readln (A[i] );

end

for i:=1 to n do 

begin

if (A[i] mod 3=0) 

then tong:=tong +A[i];

end

writeln (Tong cac phan tu chia het cho 3) 

readln ;

end

Bình luận (0)
 Khách vãng lai đã xóa
Phạm Văn Dũng
24 tháng 11 2021 lúc 10:01
Bình luận (0)
 Khách vãng lai đã xóa
Võ Anh Tuấn
24 tháng 11 2021 lúc 10:06

Program Vidu;
Uses crt;
Type Mang1C = array[1..250] of Integer; 
Var A:Mang1C;
i:integer;
Begin
        clrscr;
        Writeln
        For i:=1 to 250 do 
        Begin
                Write
                Readln
        End;
        Write
        For i:=1 to 250 do
                Write
        Readln;
End.

Bình luận (0)
 Khách vãng lai đã xóa
Thảo Nguyễn
Xem chi tiết
Thảo Nguyễn
22 tháng 12 2021 lúc 8:36

giúp em với ạ em cần gấp :(

Bình luận (0)
Nguyễn Lê Phước Thịnh
22 tháng 12 2021 lúc 8:36

#include <bits/stdc++.h>

using namespace std;

long long a[10],i,dem;

int main()

{

for (i=1; i<=10; i++) cin>>a[i];

for (i=1; i<=10; i++) cout<<a[i]<<" ";

cout<<endl;

dem=0;

for (i=1; i<=10; i++) if (a[i]%3==0) dem++;

cout<<dem;

return 0;

}

Bình luận (0)
nguyễn hoàng long
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 1 2022 lúc 22:00

#include <bits/stdc++.h>

using namespace std;

long long a[100],n,i,t,t1,dem,dem1;

//chuongtrinhcon

bool ktnt(long long x)

{

if (x<=1) return(false);

for (int i=2; i*i<=x; i++)

if (x%i==0) return(false);

return true;

}

//chuongtrinhchinh

int main()

{

cin>>n;

for (i=1; i<=n; i++)

{

cin>>a[i];

}

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

t=0;

for (i=1; i<=n; i++) if (a[i]%2==0) t=t+a[i];

cout<<t<<endl;

dem=0;

for (i=1; i<=n; i++) if (a[i]%3==0) dem++;

cout<<dem<<" ";

t1=0;

dem1=0;

for (i=1; i<=n; i++)

if (a[i]%2!=0)

{

t1+=a[i];

dem1++;

}

cout<<fixed<<setprecision(2)<<(t1*1.0)/(dem1*1.0)<<endl;

for (i=1; i<=n; i++)

if (ktnt(a[i])==true) cout<<a[i]<<" ";

return 0;

}

Bình luận (0)